{{define "title"}}{{.name}} {{end}}
{{define "content"}}
<div class="row">
	<div class="col-md-9 col-sm-6 content">
		<div class="sep20"></div>
		<ol class="breadcrumb" style="border-bottom: 1px solid #e2e2e2;">
			<div class="pull-right">
				<span class="cc f12">共 {{.respBody.NumFound}} 个主题</span>
			</div>
			<li><a href="/">首页</a></li>
			<li>TAG</li>
			<li>{{.name}}</li>
		</ol>
		
		<div class="box_white box">
			{{range .respBody.Docs}}
			<div class="cell item" style="">
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tbody><tr>
						<td width="48" valign="top" align="center">
						{{if .Uid}}
						{{$user := index $.users .Uid}}
						<a href="/user/{{$user.Username}}"><img src="{{gravatar $user.Avatar $user.Email 48 $.is_https}}" class="avatar" style="width:48px;"></a>
						{{else}}
						<a href="javascript:">
							<img class="noavatar" alt="" src="https://secure.gravatar.com/avatar/3bf6178897766ebadaa830073e87374d?s=48" data-objid="{{.Objid}}" data-objtype="{{.Objtype}}" data-author="{{.Author}}" style="width:48px;">
						</a>
						{{end}}
						</td>
						<td width="10"></td>
						
						<td width="auto" valign="middle">
							<span class="item_title">
								<a class="title noul" href="/{{if eq .Objtype 0}}topics{{else if eq .Objtype 1}}articles{{else if eq .Objtype 2}}resources{{else if eq .Objtype 4}}p{{else}}wiki{{end}}/{{.Objid}}" title="{{.Title}}">{{.Title}}</a>
							</span>
							<div class="sep5"></div>
							<span class="small c9">
								{{if .Nid}}
								{{$node := index $.nodes .Nid}}
								<a class="node" href="/go/{{$node.Ename}}">{{$node.Name}}</a>
								{{else if eq .Objtype 1}}
								<a class="node" href="/articles">文章</a>
								{{else if eq .Objtype 2}}
								<a class="node" href="/resources">分享发现</a>
								{{else if eq .Objtype 3}}
								<a class="node" href="/wiki">WIKI</a>
								{{else if eq .Objtype 4}}
								<a class="node" href="/projects">开源项目</a>
								{{end}}
								&nbsp;•&nbsp; 
								{{if .Uid}}
								{{$user := index $.users .Uid}}
								 <strong><a href="/user/{{$user.Username}}" class="noul">{{$user.Username}}</a></strong>
								{{else}}
								<span>{{.PubTime}}</span>
								{{end}}
								&nbsp;•&nbsp; 
								{{if .Lastreplyuid}}
								{{$user := index $.users .Lastreplyuid}}
								<span title="{{.Lastreplytime}}" class="timeago"></span>&nbsp;•&nbsp; 最后回复来自 <strong><a href="/user/{{$user.Username}}" class="noul">{{$user.Username}}</a></strong>
								{{else}}
								<span>{{.Viewnum}} 点击</span>
								{{end}}
							</span>
						</td>
						{{if .Cmtnum}}
						<td width="70" align="right" valign="middle">
							<a href="/{{if eq .Objtype 0}}topics{{else if eq .Objtype 1}}articles{{else if eq .Objtype 2}}resources{{else if eq .Objtype 4}}p{{else}}wiki{{end}}/{{.Objid}}" class="count_livid" title="{{.Cmtnum}}">{{.Cmtnum}}</a>
						</td>
						{{end}}

					</tr>
				</tbody></table>
			</div>
			{{end}}
		</div>
		{{if .pageHtml}}
		<div class="sep20"></div>
		<div class="box_white box">
			<div class="cell" style="margin: 0 auto; text-align: center;">
				<ul class="pagination" style="margin: 1px 0;">
					{{noescape .pageHtml}}
				</ul>
			</div>
		</div>
		{{end}}
	</div>
	<div class="col-md-3 col-sm-6">
		<div class="sep20"></div>
		{{include "common/my_info.html" .}}
	</div>
</div>
{{end}}
{{define "js"}}
<script src="https://cdn.bootcss.com/identicon.js/2.3.1/identicon.min.js"></script>
<script type="text/javascript">
// 需要加载的侧边栏
SG.SIDE_BARS = [
	"/comments/recent",
];

$(function() {
	$('.noavatar').each(function() {
		var objid = $(this).data('objid'),
			objtype = $(this).data('objtype'),
			author = $(this).data('author');
		// var hash = md5(objid+"-"+objtype);
		var hash = md5(author+"");
		var data = new Identicon(hash, {format: 'svg', size: 48}).toString();
		var imgData = 'data:image/svg+xml;base64,' + data;
		$(this).attr('src', imgData);
	});
});
</script>
{{end}}